Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Local Storage Capacity Isolation API #44785

Merged
merged 2 commits into from
Jun 1, 2017

Conversation

jingxu97
Copy link
Contributor

@jingxu97 jingxu97 commented Apr 21, 2017

This PR adds the new APIs to support storage capacity isolation as
described in the proposal https://github.com/kubernetes/community/pull/306

  1. Add SizeLimit for emptyDir volume
  2. Add scratch and overlay storage type used by container level or
    node level

Release note:

Alpha feature: Local volume Storage Capacity Isolation allows users to set storage limit to isolate EmptyDir volumes, container storage overlay, and also supports allocatable storage for shared root file system. 

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 21, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Apr 21, 2017
@jingxu97 jingxu97 requested review from thockin and vishh April 21, 2017 22:13
@nikhiljindal
Copy link
Contributor

Are you sure you wanted to refer #306?

Someone from @kubernetes/sig-storage-api-reviews should be able to review this better.
Whoever wants to take this, please feel free to remove me as reviewer.

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 3, 2017
pkg/api/types.go Outdated
@@ -580,6 +580,11 @@ type EmptyDirVolumeSource struct {
// The default is "" which means to use the node's default medium.
// +optional
Medium StorageMedium
// Total amount of local storage required for this directory.
// The default is nil which means that the directory can use all available local storage on the node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this is applicable to "memory" medium as well. Clarify that in the comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not always all available local storage on the node. maybe just say its undefined if omitted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

pkg/api/types.go Outdated
@@ -2944,6 +2949,10 @@ const (
ResourceMemory ResourceName = "memory"
// Volume size, in bytes (e,g. 5Gi = 5GiB = 5 * 1024 * 1024 * 1024)
ResourceStorage ResourceName = "storage"
// Local Storage for overlay filesystem, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
ResourceStorageOverlay ResourceName = "storage.kubernetes.io/overlay"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify that the resource names are alpha and that they can change across releases. This is important because a new concept of ResourceClasses is being discussed where not having a domain name in the user resource name request will be useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the domain part, it might be necessary to clarify 'overlay' to make sure people won't confused about the "overlay filesystem driver" and general overlay mechanism used in container, which I think we mean the later here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishh -- why not just name it alpha like gpu?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess it doesnt matter if its behind the feature gate really.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will require renaming configs post alpha.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -383,7 +383,12 @@ func validateVolumeSource(source *api.VolumeSource, fldPath *field.Path) field.E
allErrs := field.ErrorList{}
if source.EmptyDir != nil {
numVolumes++
// EmptyDirs have nothing to validate
if !utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) {
unsetSizeLimit := resource.Quantity{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about validating Pod Spec resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add validation for ResourceRequirements which will be called by validateContainer

if !utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) {
unsetSizeLimit := resource.Quantity{}
if unsetSizeLimit.Cmp(source.EmptyDir.SizeLimit) != 0 {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("emptyDir").Child("sizeLimit"), "LocalStorageCapacityIsolation are disabled by feature-gate"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is disabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@thockin
Copy link
Member

thockin commented May 17, 2017

/approve

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 17, 2017
@jingxu97 jingxu97 force-pushed the April/apistorage branch 2 times, most recently from fc90e24 to 3a0d746 Compare May 17, 2017 21:38
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 17, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 25, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 31, 2017
@jingxu97
Copy link
Contributor Author

Rebased. @thockin @vishh @derekwaynecarr PTAL

pkg/api/types.go Outdated
// The default is nil which means that the limit is undefined.
// More info: http://kubernetes.io/docs/user-guide/volumes#emptydir
// +optional
SizeLimit resource.Quantity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to understand how this field will work with memory backed volumes.

For example, if a pod has a memory request for 500Mi of memory, and has a memory backed volume of 1Gi, the total memory request is still 500Mi, correct? Users are responsible for ensuring that memory backed volumes are sized as part of their pod requests similar to how /dev/shm works? In addition, a BestEffort pod can have a memory backed volume that has a size limit without changing the pod qos?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the total memory request is still 500Mi. When specifying the size limit for emptydir, it does not change pod qos

@derekwaynecarr
Copy link
Member

Assuming the size limit for memory backed volumes does not impact QoS or how the pod cgroups are managed, this is LGTM. The scheduler still schedules based on resource requirements only.

@derekwaynecarr
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2017
if !utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) {
unsetSizeLimit := resource.Quantity{}
if unsetSizeLimit.Cmp(source.EmptyDir.SizeLimit) != 0 {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("emptyDir").Child("sizeLimit"), "LocalStorageCapacityIsolation is disabled by feature-gate"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Make the error user friendly - SizeLimit field disabled by feature-gate for EmptyDir volumes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@vishh vishh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit, otherwise LGTM

@vishh vishh removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2017
@vishh
Copy link
Contributor

vishh commented May 31, 2017

I removed the LGTM label to fix the pending nit and add a note on how EmptyDir SizeLimits apply to memory backed volumes as discussed offline.

@jingxu97
Copy link
Contributor Author

@vishh updated the comment, PTAL

This PR adds the new APIs to support storage capacity isolation as described in the proposal
kubernetes/community#306

1. Add SizeLimit for emptyDir volume
2. Add scratch and overlay storage type used by container level or
node level
@jingxu97
Copy link
Contributor Author

updated the comments, add /lgtm back

@jingxu97 jingxu97 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2017
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented May 31, 2017

@jingxu97: The following test(s) failed:

Test name Commit Details Rerun command
Jenkins GCI GCE e2e 00d7eaf link @k8s-bot gci gce e2e test this
Jenkins Bazel Build 3a0d746ac33a47f8f7c191b69a22bb81321cf966 link @k8s-bot bazel test this
Jenkins unit/integration 3a0d746ac33a47f8f7c191b69a22bb81321cf966 link @k8s-bot unit test this
Jenkins verification 3a0d746ac33a47f8f7c191b69a22bb81321cf966 link @k8s-bot verify test this

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@vishh
Copy link
Contributor

vishh commented May 31, 2017

/lgtm

@jingxu97
Copy link
Contributor Author

jingxu97 commented Jun 1, 2017

@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: derekwaynecarr, jingxu97, thockin, vishh

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@jingxu97
Copy link
Contributor Author

jingxu97 commented Jun 1, 2017

bump priority to make sure API change for this feature gets in

@k8s-github-robot
Copy link

Automatic merge from submit-queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet